// 购物车逻辑
import { useStore } from 'vuex'
// import { toRefs } from 'vue'
export const useCommonCartEffect = () => {
  const store = useStore()
  const cartList = store.state.cartList
  // 从vuex里面拿到cartList的数据
  // const { cartList } = toRefs(store.state)
  const changeCartItemInfo = (shopId, productId, productInfo, num) => {
    // 改变state里面的值
    store.commit('changeCartItemInfo', {
      shopId, productId, productInfo, num
    })
  }
  // return { cartList, changeCartItemInfo }
  return { cartList, changeCartItemInfo }
}
